package com.ghost.utils
{
	import flash.events.TimerEvent;
	import flash.net.LocalConnection;
	import flash.system.System;
	import flash.utils.Timer;
	/**
	 * memorry 回收
	 * @author ghost
	 * 
	 */	
	public class GC
	{
		private static var gcTM:Timer ;
		
		public static function startGC():void
		{
			//半分钟执行一次
			gcTM = new Timer(1000*30)
			gcTM.addEventListener(TimerEvent.TIMER , gcTimer);
			gcTM.start() ;
		}
		
		private static function gcTimer(e:TimerEvent = null):void
		{
			try 
			{
        		new LocalConnection().connect('gc');
        		new LocalConnection().connect('gc');
			}
			catch (e:Error)
			{
				System.gc();
			}
		}
		
		public static function nowGC():void
		{
			gcTimer();
		}
	}
}